serverSources = [
    'server/server.cpp',
    'common/net/socket.cpp',
    'server/serverLua.cpp',
    'common/lua/luaAux.cpp',
    'common/net/genPackets.cpp',
    'common/map.cpp',
    'common/util.cpp',
    'common/tileManager.cpp',
    'common/mobile.cpp',
    'common/animationListManager.cpp'
]

mapEditorSources = [
    'common/util.cpp',
    'common/renderSystem.cpp',
    'common/image.cpp',
    'common/animationListManager.cpp',
    'common/mobile.cpp',
    'editor/mapeditor.cpp',
    'common/map.cpp',
    'common/tileManager.cpp',
    'common/CEGUISupport.cpp'
]

clientSources = [
    'common/util.cpp',
    'common/renderSystem.cpp',
    'common/image.cpp',
    'common/animationListManager.cpp',
    'common/mobile.cpp',
    'client/main.cpp',
    'common/map.cpp',
    'common/tileManager.cpp',
    'common/net/socket.cpp',
    'common/net/genPackets.cpp',
    'common/CEGUISupport.cpp',
    'client/clientLua.cpp',
    'common/lua/luaAux.cpp'
]

createMapSources = [
    'create/createmap.cpp'
]

def configure(conf):
    conf.env['LIB_GL'] = 'GL'

    conf.env['LIB_CEGUIOpenGLRenderer'] = 'CEGUIOpenGLRenderer'

    conf.env['LIB_SDLMixer'] = 'SDL_mixer'

    conf.env['LIB_CEGUILuaScriptModule'] = 'CEGUILuaScriptModule'

    conf.env['PKGDATADIR'] = conf.env['PREFIX'] + '/share/odysi'

    conf.check_cfg(atleast_pkgconfig_version='0.0.0')
    conf.check_cfg(package='lua5.1', args='--cflags --libs', uselib_store='LUA')
    conf.check_cfg(package='sdl', args='--cflags --libs', uselib_store='SDL')
    conf.check_cfg(package='CEGUI', args='--cflags --libs', uselib_store='CEGUI')

def build(bld):
    bld.new_task_gen(
            features = 'cxx cprogram',
            source = serverSources,
            target = 'odysi_server',
            includes = ['common', 'common/net', 'common/lua'],
            defines = ['SERVER', 'PKGDATADIR = "' + bld.env['PKGDATADIR'] + '"'],
            uselib = 'LUA')
    bld.new_task_gen(
            features = 'cxx cprogram',
            source = createMapSources,
            target = 'odysi_createmap',
            includes = ['common'])
    bld.new_task_gen(
            features = 'cxx cprogram',
            source = mapEditorSources,
            target = 'odysi_mapeditor',
            includes = ['common', 'common/net'],
            defines = ['PKGDATADIR = "' + bld.env['PKGDATADIR'] + '"'],
            uselib = ['LUA', 'SDL', 'GL', 'CEGUIOpenGLRenderer', 'SDLMixer', 'CEGUILuaScriptModule', 'CEGUI'])
    bld.new_task_gen(
            features = 'cxx cprogram',
            source = clientSources,
            target = 'odysi',
            includes = ['common', 'common/net', 'common/lua'],
            defines = ['PKGDATADIR = "' + bld.env['PKGDATADIR'] + '"'],
            uselib = ['LUA', 'SDL', 'GL', 'CEGUIOpenGLRenderer', 'SDLMixer', 'CEGUILuaScriptModule', 'CEGUI'])
